<template>
  <view class="p-h24 p-t40">
    <ResumePreview v-if="myResume" :resume="myResume" />
  </view>
</template>

<script lang="ts" setup>
  import { ref } from 'vue'
  import { onLoad } from '@dcloudio/uni-app'
  import type { TResume } from '@/types/api.d'
  import ResumePreview from '@/components/resume-preview'

  const myResume = ref<TResume | null>(null)

  const getMyResume = () => {
    uni.showLoading({ mask: false })
    uni.$u.get<TResume>('/resume/my').then((res) => {
      if (res.code === 1) {
        myResume.value = res.data
      }
    }).finally(() => {
      uni.hideLoading()
    })
  }

  onLoad(() => {
    getMyResume()
  })
</script>

<style lang="scss">
	page {
		background-color: $page-color-4;
	}
</style>
